<<<<<<< HEAD
import java.util.*;
class Point{
    int id;
    double x,y;

    public Point(int id,double x,double y){
        this.id=id;
        this.x=x;
        this.y=y;
    }
}
class Polygon{
    List<Point> vertices = new ArrayList<>();
    public void addVertex(Point point){
        vertices.add(point);
    }
    public double calculatePerimeter(){
        double perimeter=0;
        int n=vertices.size();
        for(int i=0;i<n;i++){
            Point p1=vertices.get(i);
            Point p2=vertices.get((i+1)%n);
            perimeter+=Math.sqrt(Math.pow(p2.x-p1.x,2)+Math.pow(p2.y-p1.y,2));
        }
        return perimeter;
    }
    public double calculateArea(){
        double area=0;
        int n=vertices.size();
        for(int i=0;i<n;i++) {
            Point p1 = vertices.get(i);
            Point p2 = vertices.get((i + 1) % n);
            area += (p1.x * p2.x - p2.x * p1.y);
        }
        return Math.abs(area)/2.0;
    }
}
class PolygonTest{
    public static void main(String[] args ){
        Polygon polygon=new Polygon();
        polygon.addVertex(new Point(1, 1, 2));
        polygon.addVertex(new Point(2, 2, 3));
        polygon.addVertex(new Point(3, 3, 3));
        polygon.addVertex(new Point(4, 2, 2));
        System.out.println("多边形周长: " + polygon.calculatePerimeter());
        System.out.println("多边形面积: " + polygon.calculateArea());
    }
}
=======
<<<<<<< HEAD
import java.util.*;
class Road {
    String name;
    int id;
    List<int[]> points;

    public Road(String name, int id, int[][] points) {
        this.name = name;
        this.id = id;
        this.points = new ArrayList<>();
        for (int[] point : points) {
            this.points.add(point);
        }
    }

    public void printInfo() {
        System.out.println(name + ",编号" + id + ",坐标信息为：");
        for (int i=0;i<points.size();i++){
            int[] point=points.get(i);
            System.out.print("("+point[0]+","+point[1]+")");
            if(i<points.size()-1){
                System.out.printf(",");
            }
        }
        System.out.println();
    }
}
 class Test{
        public static void main(String[] args){
            Road r1=new Road("明湖路",21,new int[][]{{10,12},{15,18},{17,21}});
            Road r2=new Road("至诚路",12,new int[][]{{25,16},{35,28},{41,22},{45,32},{49,42}});
            r1.printInfo();
            r2.printInfo();
        }
    }
=======
<<<<<<< HEAD
class HelloWorld {
    public static void main(String[] args) {
        int a = 10, b = 5;
        System.out.println("a + b = " + (a + b));
        System.out.println("a - b = " + (a - b));

        for (int i = 1; i <= 3; i++) {
            System.out.println("循环次数: " + i);
        }

        String result = (a > b) ? "a大于b" : "a小于等于b";
        System.out.println(result);
=======
 class QuickJava {
    public static void main(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 10; i++) {
            sum += i;
            System.out.println("Adding " + i + ", sum = " + sum);
        }
        System.out.println("Final sum: " + sum);
>>>>>>> 7b8212bf1c53d0331c86803afd94856ca81cbbd3
    }
}
>>>>>>> 7a7f927ef4273ec22c59487a68ce6874232e6354
>>>>>>> 9afaedb96d2688b0b6d0b8b37966028831bcedf4
